﻿@model Forest.Cat.Web.Models.JobApplication.ApplyModel
@using Forest.Web.Framework
@{
    ViewBag.Title = "职位申请";
    Layout = "~/Views/Shared/_NormalRoot.cshtml";
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#template").bind('change', function () {
            if ($(this).val() != "") {
                if ($("#coverLetter").val() != '' && !confirm("选择新模板将会覆盖当前申请书的内容，确定要执行该操作吗？")) {
                    return;
                }
                $.ajax({
                    url: '@Url.Action("GetTemplateContent")',
                    type: "POST",
                    data: 'id=' + $(this).val(),
                    success: function (text) {
                        $("#coverLetter").val(text);
                    }
                });
            }
        });

        $('#ibtnSubmit').bind('click', function () {
            if ($('.resume:checked').length == 0) {
                alert('未选择简历，无法申请该职位！');
                return false;
            }
        });
    });
</script>
<div class="main_result">
    所有职位 &gt; <b>@Model.JobModel.JobTitle</b></div>
<div class="apply_content">
    <div class="apply_content_left">
        @using (Html.BeginForm("Apply", "JobApplication", FormMethod.Post))
        {
            @Html.HiddenFor(x => x.ApplicationModel.CompanyId)
            //@Html.HiddenFor(x => x.ApplicationModel.JobId)
            @Html.HiddenFor(x => x.ApplicationModel.JobPositionId)
            <div class="position_apply">
                <div class="position_apply_title">
                    您当前正在申请：@Model.JobModel.JobTitle<span>@Model.JobModel.CompanyModel.CompanyName
                        (@Html.ActionLink("查看公司介绍", "CompanyView", "Company", new { id = Model.JobModel.CompanyModel.Id }, null))</span></div>
                <div class="position_apply_box">
                    <p>
                        请确认简历是否完整，不完整的简历将影响您给企业的印象。</p>
                    <p>
                        如果信息完整并正确，请点击"提交"，应聘该职位。</p>
                </div>
            </div>
            <div class="resume_choice">
                <div class="resume_choice_title">
                    选择简历</div>
                <div class="resume_choice_box">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <th>
                                简历名称
                            </th>
                            <th>
                                备注
                            </th>
                            @*<th>
                                操作
                            </th>*@
                        </tr>
                        @foreach (var item in Model.ResumeModelList)
                        {
                            <tr>
                                <td style="text-align: left; padding-left: 10px">
                                    @Html.RadioButtonFor(x => x.ApplicationModel.ResumeId, item.Id, new {@class="resume", @checked = item.PrivacyStatus == 1 ? "checked" : "" })
                                    @item.ResumeName
                                </td>
                                <td>
                                    @Html.SetDisplayTextLength(item.Notes, 15)
                                </td>
@*                                <td>
                                    <a href="#">预览</a><a href="#">修改</a>
                                </td>*@
                            </tr>
                        }
                    </table>
                </div>
            </div>
            <div class="letter_apply">
                <div class="letter_apply_title">
                    附上您的求职信</div>
                <div class="letter_apply_box">
                    选择预存的求职信模板
                    @Html.DropDownList("template", Model.TemplateList)
                    @Html.TextAreaFor(x => x.ApplicationModel.CoverLetter, new { @id = "coverLetter" })
                </div>
            </div>
            <div class="expect_salary">
                <div class="expect_salary_title">
                    期望薪资</div>
                <div class="expect_salary_box">
                    <div class="salary">
                        月薪范围：@Html.DropDownListFor(x => x.ApplicationModel.DesiredSalary, Model.DesiredSalaryList)
                    </div>
                    <span>请合理选择自己的薪资报酬，这将有助于您收到一份工作岗位！</span>
                    <div class="cl">
                    </div>
                </div>
                <div class="backResule">
                    <input id="ibtnSubmit" type="image" src="/Themes/DarkOrange/Content/images/img-jobview_applyBtn-89-27.jpg" />
                    <a href="@Model.ReturnUrl">返回到搜索结果</a></div>
            </div>
        }
    </div>
    <div class="apply_content_right">
        @Html.Partial("_JobSummary", Model.JobModel)
    </div>
    <div class="cr">
    </div>
</div>
